﻿// -----------------------------------------------------------------------------
// Generate By Furion Tools v2.16.0                            
// -----------------------------------------------------------------------------

using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using HOPU.OnlineSchool.Core;

namespace HOPU.OnlineSchool.Core
{
    public partial class TOrder : IEntity<MasterDbContextLocator>, IEntityTypeBuilder<TOrder, MasterDbContextLocator>
    {
    
        public string Id { get; set; }
        public string OrderNo { get; set; }
        public string CourseId { get; set; }
        public string CourseTitle { get; set; }
        public string CourseCover { get; set; }
        public string TeacherName { get; set; }
        public string MemberId { get; set; }
        public string Nickname { get; set; }
        public string Mobile { get; set; }
        public decimal? TotalFee { get; set; }
        public byte? PayType { get; set; }
        public byte? Status { get; set; }
        public byte IsDeleted { get; set; }
        public DateTime GmtCreate { get; set; }
        public DateTime GmtModified { get; set; }
    
        public void Configure(EntityTypeBuilder<TOrder> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
                entityBuilder.ToTable("t_order");

                entityBuilder.HasComment("订单");

                entityBuilder.HasIndex(e => e.CourseId, "idx_course_id");

                entityBuilder.HasIndex(e => e.MemberId, "idx_member_id");

                entityBuilder.HasIndex(e => e.OrderNo, "ux_order_no")
                    .IsUnique();

                entityBuilder.Property(e => e.Id)
                    .HasMaxLength(19)
                    .HasColumnName("id")
                    .HasDefaultValueSql("''")
                    .IsFixedLength(true);

                entityBuilder.Property(e => e.CourseCover)
                    .HasMaxLength(255)
                    .HasColumnName("course_cover")
                    .HasComment("课程封面");

                entityBuilder.Property(e => e.CourseId)
                    .IsRequired()
                    .HasMaxLength(19)
                    .HasColumnName("course_id")
                    .HasDefaultValueSql("''")
                    .HasComment("课程id");

                entityBuilder.Property(e => e.CourseTitle)
                    .HasMaxLength(100)
                    .HasColumnName("course_title")
                    .HasComment("课程名称");

                entityBuilder.Property(e => e.GmtCreate)
                    .HasColumnName("gmt_create")
                    .HasComment("创建时间");

                entityBuilder.Property(e => e.GmtModified)
                    .HasColumnName("gmt_modified")
                    .HasComment("更新时间");

                entityBuilder.Property(e => e.IsDeleted)
                    .HasColumnName("is_deleted")
                    .HasComment("逻辑删除 1（true）已删除， 0（false）未删除");

                entityBuilder.Property(e => e.MemberId)
                    .IsRequired()
                    .HasMaxLength(19)
                    .HasColumnName("member_id")
                    .HasDefaultValueSql("''")
                    .HasComment("会员id");

                entityBuilder.Property(e => e.Mobile)
                    .HasMaxLength(11)
                    .HasColumnName("mobile")
                    .HasComment("会员手机");

                entityBuilder.Property(e => e.Nickname)
                    .HasMaxLength(50)
                    .HasColumnName("nickname")
                    .HasComment("会员昵称");

                entityBuilder.Property(e => e.OrderNo)
                    .IsRequired()
                    .HasMaxLength(20)
                    .HasColumnName("order_no")
                    .HasDefaultValueSql("''")
                    .HasComment("订单号");

                entityBuilder.Property(e => e.PayType)
                    .HasColumnType("tinyint")
                    .HasColumnName("pay_type")
                    .HasComment("支付类型（1：微信 2：支付宝）");

                entityBuilder.Property(e => e.Status)
                    .HasColumnType("tinyint")
                    .HasColumnName("status")
                    .HasComment("订单状态（0：未支付 1：已支付）");

                entityBuilder.Property(e => e.TeacherName)
                    .HasMaxLength(20)
                    .HasColumnName("teacher_name")
                    .HasComment("讲师名称");

                entityBuilder.Property(e => e.TotalFee)
                    .HasColumnType("decimal(10,2)")
                    .HasColumnName("total_fee")
                    .HasDefaultValueSql("'0.01'")
                    .HasComment("订单金额（分）");
        }

    }
}
